clear all
*the data link below will need to be changed
use "N:\Personal Research - Masks (COVID) and prof ideology\data for publication\the masks we wear data.dta", clear
*
***************  baseline **********************
global ctrl spring2021 fall2021 spring2022 fall2022 ausderan
reg ideolo_hypo2 whitemask $ctrl, cluster(classid) //ns, note that they are sig if run as long form
est sto white
reg ideolo_hypo3 blackmask $ctrl, cluster(classid) //ns, " "
est sto black
reg ideolo_hypo4 asianmask $ctrl, cluster(classid) //ns, " "
est sto asian
*
estout white black asian, style(tab) cells(b(star fmt(%9.3f))  se(par(`"="("'`")""'))) ///
stats(N r2_o N_clust N_g rho sigma_u sigma_e) starlevels(+ 0.10 * 0.05 ** 0.01) delimiter(;)
*
*
*
*
*************************************************
*				ROBUSTNESS						*
*************************************************
*pid
reg pid7_hypo2 whitemask $ctrl, cluster(classid) //ns, note that they are sig if run as long form
est sto pidw
reg pid7_hypo3 blackmask $ctrl, cluster(classid) //ns, " "
est sto pidb
reg pid7_hypo4 asianmask $ctrl, cluster(classid) //ns, " "
est sto pida
estout pidw pidb pida, style(tab) cells(b(star fmt(%9.3f))  se(par(`"="("'`")""'))) ///
stats(N r2_o N_clust N_g rho sigma_u sigma_e) starlevels(+ 0.10 * 0.05 ** 0.01) delimiter(;)
*
*********** Attention check ***********
reg ideolo_hypo2 whitemask $ctrl if attentionpass==1, cluster(classid)  //
est sto attenw
reg ideolo_hypo3 blackmask $ctrl if attentionpass==1, cluster(classid) //
est sto attenb
reg ideolo_hypo4 asianmask $ctrl if attentionpass==1, cluster(classid)  //
est sto attena
*
estout attenw attenb attena, style(tab) cells(b(star fmt(%9.3f))  se(par(`"="("'`")""'))) ///
stats(N r2_o N_clust N_g rho sigma_u sigma_e) starlevels(+ 0.10 * 0.05 ** 0.01) delimiter(;)

*********** pol knowledge ***********
gen polknow1=1 if know_ryan==1
gen polknow2 =1 if  know_russia_pres==1
gen polknow3=1 if  know_spending==5
gen polknow4=1 if know_repub == 1
gen polknow5=1 if know_medicare==1
gen polknow6=1 if know_un==1
gen polknow7=1 if know_budget==1
gen polknow8=1 if know_presterm==2
gen polknow9=1 if know_minwage==4
egen polknowAVR = rowtotal(polknow1 polknow2 polknow3 polknow4 polknow5 polknow6  ///
polknow7 polknow8 polknow9)
replace polknowAVR = polknowAVR/9
*
reg ideolo_hypo2 whitemask $ctrl if polknowAVR>=.6877, cluster(classid)  //
est sto knoww
reg ideolo_hypo3 blackmask $ctrl if polknowAVR>=.6877, cluster(classid) //
est sto knowb
reg ideolo_hypo4 asianmask $ctrl if polknowAVR>=.6877, cluster(classid)  //
est sto knowa
*
estout knoww knowb knowa, style(tab) cells(b(star fmt(%9.3f))  se(par(`"="("'`")""'))) ///
stats(N r2_o N_clust N_g rho sigma_u sigma_e) starlevels(+ 0.10 * 0.05 ** 0.01) delimiter(;)

************* Favorability and masks **********************
*
gen ideoXwmask = self_ideo*whitemask
gen ideoXbmask = self_ideo*blackmask
gen ideoXamask = self_ideo*asianmask
*
global ctrl spring2021 fall2021 spring2022 fall2022 ausderan //
*first, basic favorability
reg favor_hypo2 self_ideo ideoXwmask whitemask $ctrl, cluster(classid) //ns
est sto favorw
reg favor_hypo3 self_ideo ideoXbmask blackmask $ctrl, cluster(classid) //ns
est sto favorb
reg favor_hypo4 self_ideo ideoXamask asianmask $ctrl, cluster(classid) //sig for self .10
est sto favora
estout favorw favorb favora, style(tab) cells(b(star fmt(%9.3f)) se(par(`"="("'`")""'))) ///
stats(N r2_o N_clust N_g rho sigma_u sigma_e) starlevels( * 0.05 ** 0.01) delimiter(;)

*next, prog ideolo with student ideolo interaction
reg ideolo_hypo2 self_ideo ideoXwmask whitemask $ctrl, cluster(classid) //ns
reg ideolo_hypo3 self_ideo ideoXbmask blackmask $ctrl, cluster(classid) //almost sig but opposite
reg ideolo_hypo4 self_ideo ideoXamask asianmask $ctrl, cluster(classid) //ns
*white prof - none sig
reg agree_diss_prof2_1 self_ideo ideoXwmask whitemask $ctrl, cluster(classid)
reg agree_diss_prof2_2 self_ideo ideoXwmask whitemask $ctrl, cluster(classid)
reg agree_diss_prof2_3 self_ideo ideoXwmask whitemask $ctrl, cluster(classid)
reg agree_diss_prof2_4 self_ideo ideoXwmask whitemask $ctrl, cluster(classid)
*black prof - none sig at .05
reg agree_diss_prof2_1 self_ideo ideoXbmask blackmask $ctrl, cluster(classid)
reg agree_diss_prof2_2 self_ideo ideoXbmask blackmask $ctrl, cluster(classid)
reg agree_diss_prof2_3 self_ideo ideoXbmask blackmask $ctrl, cluster(classid) //sig at .10
reg agree_diss_prof2_4 self_ideo ideoXbmask blackmask $ctrl, cluster(classid)
************** Congruence  - IDEOLO ************
reg congruence2 whitemask $ctrl, cluster(classid)
est sto idcongruw
reg congruence3 blackmask $ctrl, cluster(classid)
est sto idcongrub
reg congruence4 asianmask $ctrl, cluster(classid)
est sto idcongrua

estout idcongruw idcongrub idcongrua, style(tab) cells(b(star fmt(%9.3f))  se(par(`"="("'`")""'))) ///
stats(N r2_o N_clust N_g rho sigma_u sigma_e) starlevels(+ 0.10 * 0.05 ** 0.01) delimiter(;)
*
************** Congruence  - PID *************
*
gen pcong2 = whitemask*pid_congruence2
gen pcong3 = whitemask*pid_congruence3
gen pcong4 = whitemask*pid_congruence4
*
reg ideolo_hypo2 whitemask congruence2 pcong2 $ctrl, cluster(classid) //sig
reg ideolo_hypo3 blackmask congruence3 pcong3 $ctrl, cluster(classid) //ns, " "
reg ideolo_hypo4 asianmask congruence4 pcong4 $ctrl, cluster(classid) //ns, " "
*
********* by ideolgoy where moderate is the baseline (b3.)*************
reg ideolo_hypo2 whitemask b3.self_ideo $ctrl, cluster(classid) //ns, note that they are sig if run as long form
est sto whiteI
reg ideolo_hypo3 blackmask b3.self_ideo $ctrl, cluster(classid) //ns, " "
est sto blackI 
reg ideolo_hypo4 asianmask b3.self_ideo $ctrl, cluster(classid) //ns, " "
est sto asianI
*
estout whiteI blackI asianI, style(tab) cells(b(star fmt(%9.3f))  se(par(`"="("'`")""'))) ///
stats(N r2_o N_clust N_g rho sigma_u sigma_e) starlevels(+ 0.10 * 0.05 ** 0.01) delimiter(;)
******** by ideology x treatment where moderate is baseline *****
reg ideolo_hypo2 whitemask b3.self_ideo whitemask##self_ideo $ctrl, cluster(classid) //ns, note that they are sig if run as long form
est sto whiteIX
reg ideolo_hypo3 blackmask b3.self_ideo blackmask##self_ideo $ctrl, cluster(classid) // interesting, there was some evidence of more liberal mask wearing interaction, but only here
est sto blackIX
reg ideolo_hypo4 asianmask b3.self_ideo asianmask##self_ideo $ctrl, cluster(classid) //ns, " "
est sto asianIX
*
estout whiteIX blackIX asianIX, style(tab) cells(b(star fmt(%9.3f))  se(par(`"="("'`")""'))) ///
stats(N r2_o N_clust N_g rho sigma_u sigma_e) starlevels(+ 0.10 * 0.05 ** 0.01) delimiter(;)

************ by pid where 7 is str dem, 4 (moderate) is baseline ****
reg ideolo_hypo2 whitemask b4.pid7_dem $ctrl, cluster(classid) //ns, note that they are sig if run as long form
est sto whiteP
reg ideolo_hypo3 blackmask b4.pid7_dem $ctrl, cluster(classid) //str repub thought more liberal
est sto blackP
reg ideolo_hypo4 asianmask b4.pid7_dem $ctrl, cluster(classid) //ns, " "
est sto asianP
*
estout whiteP blackP asianP, style(tab) cells(b(star fmt(%9.3f))  se(par(`"="("'`")""'))) ///
stats(N r2_o N_clust N_g rho sigma_u sigma_e) starlevels(+ 0.10 * 0.05 ** 0.01) delimiter(;)
*********** by pid x treatment where indept (4) is baseline ****
reg ideolo_hypo2 whitemask b4.pid7_dem whitemask##pid7_dem $ctrl, cluster(classid) // whitemask is sig and poz and weak repub interaction is sig and poz
est sto whitePX
reg ideolo_hypo3 blackmask b4.pid7_dem blackmask##pid7_dem $ctrl, cluster(classid) //NS
est sto blackPX
reg ideolo_hypo4 asianmask b4.pid7_dem asianmask##pid7_dem $ctrl, cluster(classid) // odd, masking wearing is only sig for lean repub but more Conserv...that is odd
est sto asianPX
*
estout whitePX blackPX asianPX, style(tab) cells(b(star fmt(%9.3f))  se(par(`"="("'`")""'))) ///
stats(N r2_o N_clust N_g rho sigma_u sigma_e) starlevels(+ 0.10 * 0.05 ** 0.01) delimiter(;)
*****************************************
*
* END OF FILE
